package com.lagou.Thread;

import com.lagou.bean.ConsumerComponent;

/**
 * @author czq
 * @date 2020/9/3 1:49
 */
public class Task implements Runnable {

    private String name;

    private ConsumerComponent consumerComponent;

    public Task(String name, ConsumerComponent consumerComponent) {
        this.name = name;
        this.consumerComponent = consumerComponent;
    }

    @Override
    public void run() {
        if ("methodA".equals(name)) {
            consumerComponent.methodA("methodA");
        } else if ("methodB".equals(name)) {
            consumerComponent.methodB("methodB");
        } else {
            consumerComponent.methodC("methodC");
        }
    }
}
